Release 10.1A: OpenEdge Development:
Progress 4GL Handbook


STOP condition

Progress supports a STOP statement that lets the user terminate or restart your application altogether if an unrecoverable error occurs. You can trap the STOP condition in your block header statements as well. The STOP condition occurs when a Progress STOP statement executes or when the user presses the keyboard key mapped to that value. The STOP key, by default, is mapped to CTRL+BREAK in Windows and CTRL+C on UNIX.

When the STOP condition occurs, by default Progress undoes the current transaction (if any). If the user starts the application from an OpenEdge tool, such as the Procedure Editor, Progress terminates the application and returns to that tool. Otherwise, if the user starts the application using the Startup procedure (-p) startup option on the OpenEdge session, Progress reruns the startup procedure.

Progress raises the STOP condition when an unrecoverable system error occurs, such as when a database connection is lost or an external procedure that your code runs cannot be found. You cannot put the NO-ERROR condition on a RUN statement for an external procedure, as you can for an internal procedure. Therefore, the only way to trap such an error is to put the statement in a DO ON STOP block such as this:

DO ON STOP undo, LEAVE: 
     RUN foo.p. 
END. 
MESSAGE "The procedure to support your last action cannot be found."  
        SKIP "Please try another option." VIEW-AS ALERT-BOX. 

If the procedure isn’t found you still get an error, as shown in Figure 17–13.

Figure 17–13: Procedure not found error message

But your procedure continues executing and you can deal with the error, as shown in Figure 17–14.

Figure 17–14: Example message for procedure not found condition

If you anticipate that this might happen, it is better to use the SEARCH function to determine in advance whether Progress can find the procedure in the current PROPATH:

IF SEARCH("foo.p") = ? THEN 
  MESSAGE "The procedure to support your last action cannot be found."  
     SKIP "Please try another option." VIEW-AS ALERT-BOX. 
ELSE RUN foo.p. 

System and software failures

Following a system hardware or hardware failure that it cannot recover from, Progress undoes any partially completed transactions for all users. This includes any work done in any complete or incomplete subtransaction encompassed within the uncommitted transaction.

If Progress loses a database connection (for example, because a remote server fails), client processing can still continue. In this case, the following actions occur:

Progress continues to undo blocks until it reaches an ON STOP phrase. If no ON STOP phrase is reached, it undoes all active blocks and restarts the top-level procedure.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095